// JavaScript Documentvar error = "";
				var supname="";
				var supcomname="";
				var supcity="";
				var supstate="";
				var supcountry="";
				var suppstl="";
				var supphone="";
				var supemail="";
				var supgoods="";
				var supcod="";
				var supcusid="";
				var supadd="";
function validateForm2(strURL,formname,responsediv,responsemsg) {
				error = "";
				var _boolForm = 0;
				var emptyPreMessge = "You must include an accurate";
				var emptyPostMessge = "for a response";
				supname=document.forms["frmsuplier"]["txtSupplierName"].value;
				supcomname=document.forms["frmsuplier"]["txtCompanyName"].value;
				supcity=document.forms["frmsuplier"]["txtCity"].value;
				supstate=document.forms["frmsuplier"]["txtState"].value;
				supcountry=document.forms["frmsuplier"]["txtCountry"].value;
				suppstl=document.forms["frmsuplier"]["txtPostalCode"].value;
				supemail=document.forms["frmsuplier"]["txtEmail"].value;
				supadd=document.forms["frmsuplier"]["textAdd"].value;
				supphone=document.forms["frmsuplier"]["txtPhone"].value;
				supgoods=document.forms["frmsuplier"]["txtTypeGoods"].value;
				supcod=document.forms["frmsuplier"]["textcurrOrderDetails"].value;
				supcusid=document.forms["frmsuplier"]["ddlCustomerId"].value;
				
		
				
				
				
				document.getElementById("status").innerHTML	= "";
				var nameError = "";
				if(supname == "" || supname == null)
				{
					document.forms["frmsuplier"]["txtSupplierName"].focus();
					error = "Supplier Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(supname,3,25) == true)
				{
					
					if(isAlphabet(supname) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmsuplier"]["txtSupplierName"].focus();
						error = "Supplier Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
						document.forms["frmsuplier"]["txtSupplierName"].focus();
					error = "Please enter the Supplier Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
					
					if(supcomname == "" || supcomname == null)
				{
					document.forms["frmsuplier"]["txtCompanyName"].focus();
					error = " CompanyName must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(supcomname,3,25) == true)
				{
					
					if(isAlphabet(supcomname) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmsuplier"]["txtCompanyName"].focus();
						error = "Company Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
						document.forms["frmsuplier"]["txtCompanyName"].focus();
					error = "Please enter the Company Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				
			if(supcity == "" || supcity == null)
				{
					document.forms["frmsuplier"]["txtCity"].focus();
					error = "City Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(supcity,3,25) == true)
				{
					
					if(isAlphabet(supcity) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmsuplier"]["txtCity"].focus();
						error = "City Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
						document.forms["frmsuplier"]["txtCity"].focus();
					error = "Please enter the City Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				if(supstate == "" || supstate == null)
				{
					document.forms["frmsuplier"]["txtState"].focus();
					error = "State Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(supstate,3,25) == true)
				{
					
					if(isAlphabet(supstate) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmsuplier"]["txtState"].focus();
						error = " State Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
						document.forms["frmsuplier"]["txtState"].focus();
					error = "Please enter the State Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				
				
								if(supcountry == "" || supcountry == null)
				{
					document.forms["frmsuplier"]["txtCountry"].focus();
					error = " Country Name must not be empty";
					document.getElementById("status").innerHTML	= error;
					//alert(error);	
					return false;	
				}
				else if(lengthRestriction(supcountry,3,25) == true)
				{
					
					if(isAlphabet(supcountry) == true)
					{
						_boolForm = 0;  // if valid bool setting to zero check other fields
					}
					else
					{
						document.forms["frmsuplier"]["txtCountry"].focus();
						error = "Country Name must contain only letters";
						document.getElementById("status").innerHTML	= error;
						return false;
					}
				}
				else
				{
						document.forms["frmsuplier"]["txtCountry"].focus();
					error = "Please enter the Country Name between " +3+ " and " +25+ " characters";
					document.getElementById("status").innerHTML	= error;
					return false;
				}
				
				if(supadd == ""||supadd ==null)
								{
									document.forms["frmsuplier"]["textAdd"].focus();
									error = "Address must not be empty";
									document.getElementById("status").innerHTML	= error;
									//alert(error);	
									return false;	
								}
								
								
									if(suppstl == "" || suppstl == null)
								{
									document.forms["frmsuplier"]["txtPostalCode"].focus();
									error = "Postal Code must not be empty";
									document.getElementById("status").innerHTML	= error;
									//alert(error);	
									return false;	
								}
								
														
								if(supemail == "" || supemail == null) // Email is not entered feels it is empty
								{
									//show_image();
									document.forms["frmsuplier"]["txtEmail"].focus();
									error = "Email must not be empty";
									document.getElementById("status").innerHTML	= error;
									
									
									return false;
								}
								else if(emailcheck(supemail) == true )// Email is  entered feels it is valide elase not valid
								{
									_boolForm = 0;  // if valid bool setting to zero check other fields
								}
								else // Email is not valid
								{
									document.forms["frmsuplier"]["txtEmail"].focus();
									error = emptyPreMessge+" Email Address "+emptyPostMessge;
									document.getElementById("status").innerHTML	= error;
									return false; // email not valid so returning false
								}
								
								
								
								if(supphone == "" || supphone == null)
								{
									document.forms["frmsuplier"]["txtPhone"].focus();
									error = "Phone Number must not be empty";
									document.getElementById("status").innerHTML	= error;
									return false
								}
								else if(phonelength(supphone,8) == true)
								{
										
									_boolForm = 1;
								}
								else 
								{
									//alert("Error message supemail else supphone");
									error = "Please enter the Phone Number with your country code";
									return false;
								}
								
								if(_boolForm == 1)
								{
							document.getElementById("frmsuplier").submit();
							
							}
									
					
							else
							return false;
								
				}
				
				function getTinyFormQuerystring() {
				
				   var qstr = "email="+supemail+"&name="+cstName+"&phone="+supphone+"&message="+cstMsg;
					alert(qstr);
					return qstr;
				
				}
				
				function updatepage(str,responsediv){
				
					document.getElementById(responsediv).innerHTML = str;
				
				}
				
function getTinyFormData() {
   var qstr = "Email="+"rkumar.v27@gmail.com"+"&Name="+"hello"+"&txtPhone="+"2-54590-6506-0";
    return qstr;
}

function updatepage(str,responsediv){
    document.getElementById(responsediv).innerHTML = str;
}


function emailcheck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   //alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    //alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    //alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    //alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		   // alert("Invalid E-mail ID")
		    return false
		 }

 		 return true;					
	}
	
function lengthRestriction(str, min, max){
	//var uInput = elem.value;
	//alert("lent")
	if(str.length >= min && str.length <= max){
		return true;
	}else{
		//alert("Please enter between " +min+ " and " +max+ " characters");
	//	document.forms["frmsuplier"]["supname"].focus();
//		error = "Please enter the Name between " +min+ " and " +max+ " characters";
//		document.getElementById("status").innerHTML	= error;
		return false;
	}
}

function isAlphabet(str){
	var alphaExp = /^[a-zA-Z-_ .',]+$/;
	if(str.match(alphaExp)){
		return true;
	}else{
		//alert("name must contain only letters");
//		document.forms["frmsuplier"]["Name"].focus();
//		error = "Name must contain only letters";
//		document.getElementById("status").innerHTML	= error;
		//elem.focus();
		return false;
	}
}

function phonelength(str,min){
	//var uInput = elem.value;
	if(str.length >= min){
		return true;
	}else{
		//alert("Please enter the phone number with your country code");
		document.forms["frmsuplier"]["txtPhone"].focus();
		error = "Please enter the Phone Number with your country code";
		document.getElementById("status").innerHTML	= error;
		return false;
	}
}

function numbersonly(e) {
var unicode=e.charCode? e.charCode : e.keyCode;
//alert(unicode)
	if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
			if(unicode == 40 || unicode == 41) // () allowing
			{
				return true;
			}
			else if(unicode == 45 || unicode == 43) //45- && 43 + 
			{
				return true;
			}
			else if(unicode == 58 || unicode == 32) //58 :- && 32 space
			{
				return true;
			}
			else if(unicode == 37 || unicode == 39) //Delete
			{
				return true;
			}
			else if(unicode == 46 || unicode == 13) //Delete and enter
			{
				return true;
			}
			else if(unicode == 9) //tab
			{
				return true;
			}
			else if (unicode<48||unicode>57)
			{
			  document.getElementById("status").innerHTML	= "Please enter the numbers";
			  return false;//if not a number return false //disable key press
			}
		}
} 

// append image
//var img = document.createElement("img");
function show_image() {
    var img = document.createElement("IMG");
	//img.src = "Small Alert Icon.png";
    img.src = "Small Alert Icon.png";
   // img.width = width;
   // img.height = height;
    //img.alt = alt;

    // This next line will just add it to the <body> tag
    //document.body.appendChild(img);
	document.getElementById('status').appendChild(img);
}


